//
//  ViewController.m
//  UI作业1
//
//  Created by dllo on 16/6/3.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor lightGrayColor];
    [self creadSubViews];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
  
}
-(void)creadSubViews{
   
    NSInteger weidth = self.view.frame.size.width / 5;
    NSInteger height = self.view.frame.size.height / 8 ;
    for (int i = 8 ;i > 0 ; i--) {
        for(int j = 5; j  > 0   ;j--){
            int a = arc4random() % 255;
            int b = arc4random() % 255;
            int c = arc4random() % 255;
            UIView *vie = [[UIView alloc]initWithFrame:CGRectMake(weidth *( j-1), height*( i-1), weidth, height)];
            vie.backgroundColor = [UIColor colorWithRed:a / 255.0 green:b / 255.0 blue:c/255.0 alpha:1];
            [self.view addSubview: vie];
            [vie release];
        }
    }
    
    
    
    
    
    
}

@end
